#ifndef ROOM_FLOWER_COMMAND_IN_H_
#define ROOM_FLOWER_COMMAND_IN_H_
#include "command.h"

#pragma pack(1)
namespace Cmd
{
        namespace RoomFlower
        {
                //  cmd declaration
                enum {
                        CMDIN_LOGIN             = 0x0016,       // 登录RoomRecordServer验证指令
                        CMDIN_FORWARD           = 0x0017,
                        CMDIN_ROOM              = 0x0018,       // 与RoomServer交互的指令
                        CMDIN_SESSION           = 0x0019,
                };
                enum { //CMDIN_LOGIN
                        SCMDIN_LOGIN                            = 0x0001,       // 请求登录RoomRecordServer
                        SCMDIN_LOGIN_RESPONCE                   = 0x0002,	// 登录RoomRecordServer返回
                };
                enum { //CMD_FORWARD
                        SCMDIN_FORWARD_USER_CMD_TO_ROOMFLOWER   = 0x0001,
                        SCMDIN_FORWARD_USER_CMD_TO_ROOM         = 0x0002,
                        SCMDIN_FORWARD_USER_CMD_TO_USER         = 0x0003,
                };
                enum { //CMDIN_ROOM
                        SCMDIN_REQ_USER_OWN_FLOWER              = 0x0001,
                        SCMDIN_RES_USER_OWN_FLOWER              = 0x0002,
                        SCMDIN_NOTIFY_SAVE_USER_OWN_FLOWER      = 0x0003,
                        SCMDIN_NOTIFY_RESET_USER_SEND_FLOWER    = 0x0004,
                        SCMDIN_NOTIFY_USER_ENTER_ROOM           = 0x0005,
                        SCMDIN_NOTIFY_USER_LEAVE_ROOM           = 0x0006,
                };
                enum { //CMDIN_SESSION
                        SCMDIN_SESSION_ADD_USER_SEND_FLOWER_REQ = 0x0001,
                };

                // cmd login
                struct stLoginCmd:t_NullCmd
                {
                        stLoginCmd():
                                t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN)
                        {
                                server_type_ = 0;
                                server_id_ = 0;
                                dest_type_ = ROOMFLOWERSERVER;
                        }
                        WORD server_type_;
                        DWORD server_id_;
                        WORD dest_type_;
                };
                struct stLoginResponce:t_NullCmd
                {
                        stLoginResponce():
                                t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN_RESPONCE)
                        {
                        }
                };

                // cmd forward
                struct stForwardUserCmdToRoomFlower : t_NullCmd
                {
                        stForwardUserCmdToRoomFlower():
                                t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_USER_CMD_TO_ROOMFLOWER)
                        {
                                room_id_ = 0;
                                user_id_ = 0;
                                size_ = 0;
                        }

                        DWORD getSize() const 
                        { 
                                return sizeof(*this) + size_ * sizeof(data_[0]); 
                        }

                        DWORD room_id_;
                        DWORD user_id_;
                        WORD size_;
                        BYTE data_[0];
                };
                struct stForwardUserCmdToRoom : t_NullCmd
                {
                        stForwardUserCmdToRoom():
                                t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_USER_CMD_TO_ROOM)
                        {
                                room_id_ = 0;
                                user_id_ = 0;
                                size_ = 0;
                        }

                        DWORD getSize() const 
                        { 
                                return sizeof(*this) + size_ * sizeof(data_[0]); 
                        }

                        DWORD room_id_;
                        DWORD user_id_;
                        WORD size_;
                        BYTE data_[0];
                };
                struct stForwardUserCmdToUser : t_NullCmd
                {
                        stForwardUserCmdToUser():
                                t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_USER_CMD_TO_USER)
                        {
                                user_id_ = 0;
                                size_ = 0;
                        }

                        uint32_t getSize() const 
                        { 
                                return sizeof(*this) + size_ * sizeof(data_[0]); 
                        }

                        uint32_t user_id_;
                        uint16_t size_;
                        uint8_t data_[0];
                };

                // cmd room
                struct stRoomCmdBase : t_NullCmd
                {
                        stRoomCmdBase(WORD subcmd)
                                : t_NullCmd(CMDIN_ROOM, subcmd)
                        {
                                room_id_ = 0;
                        }

                        DWORD room_id_;
                };

                struct stRoomReqUserOwnFlower : stRoomCmdBase
                {
                        stRoomReqUserOwnFlower() :
                                stRoomCmdBase(SCMDIN_REQ_USER_OWN_FLOWER)
                        {
                                user_id_ = 0;
                        }

                        DWORD user_id_;
                };
                struct stRoomResUserOwnFlower : stRoomCmdBase
                {
                        stRoomResUserOwnFlower() :
                                stRoomCmdBase(SCMDIN_RES_USER_OWN_FLOWER)
                        {
                                user_id_ = 0;
                                own_flower_ = 0;
                        }

                        DWORD user_id_;
                        DWORD own_flower_;
                };
                struct stRoomNotifySaveUserOwnFlower : stRoomCmdBase
                {
                        stRoomNotifySaveUserOwnFlower() :
                                stRoomCmdBase(SCMDIN_NOTIFY_SAVE_USER_OWN_FLOWER)
                        {
                                user_id_ = 0;
                        }

                        DWORD user_id_;
                };
                struct stRoomNotifyResetUserSendFlower : stRoomCmdBase
                {
                        stRoomNotifyResetUserSendFlower() :
                                stRoomCmdBase(SCMDIN_NOTIFY_RESET_USER_SEND_FLOWER)
                        {
                                send_flower_ = 0;
                        }

                        DWORD send_flower_;
                };
                struct stRoomNotifyUserEnterRoom : stRoomCmdBase
                {
                        stRoomNotifyUserEnterRoom() :
                                stRoomCmdBase(SCMDIN_NOTIFY_USER_ENTER_ROOM)
                        {
                                user_id_ = 0;
                        }

                        DWORD user_id_;
                };
                struct stRoomNotifyUserLeaveRoom : stRoomCmdBase
                {
                        stRoomNotifyUserLeaveRoom() :
                                stRoomCmdBase(SCMDIN_NOTIFY_USER_LEAVE_ROOM)
                        {
                                user_id_ = 0;
                        }

                        DWORD user_id_;
                };

                struct stSessionAddUserSendFlowerReq:
                        t_NullCmd
                {
                        stSessionAddUserSendFlowerReq():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_ADD_USER_SEND_FLOWER_REQ)
                        {
                                user_id = 0;
                                send_flower = 0;
                        }
                        uint32_t user_id;
                        uint32_t send_flower;
                };
        };      // namespace RoomFlower
};      // namespace Cmd

#pragma pack()  // pack(1)

#endif  // ROOM_FLOWER_COMMAND_IN_H_
